package org.egedede.processmanager.utils;

import org.egedede.processmanager.ProcessDefinition;

import com.google.common.base.Predicate;

public class IsFinishedPredicate implements Predicate<ProcessDefinition> {

	private final boolean searchForFinished;

	public IsFinishedPredicate(boolean b) {
		this.searchForFinished = b;
	}

	@Override
	public boolean apply(ProcessDefinition input) {
		if (this.searchForFinished) {
			return input.isFinished();
		} else {
			return !input.isFinished();
		}
	}

}
